<?php
/**
 * WB_S3ObjectInfo class
 * 
 * @author Jean-Lou Dupont
 * @version @@package-version@@
 * @id $Id: S3ObjectInfo.php 144 2008-03-14 18:57:42Z jldupont $
 */

 //{{include
  require_once 'web-bloks/AmazonS3/info/S3EntityInfo.php';
 //include}}
 
 class WB_S3ObjectInfo
	extends WB_S3EntityInfo
 {
 	/**
 	 * Fields from the body
 	 * of a response
 	 */
 	static $fieldsBody = array(
	
	 	'key',
		'lastmodified',
		'etag',
		'size',
		'storageclass'
	);

	/**
	 * Fields from an 'HEAD'
	 * operation.
	 */	
	static $fieldsHead = array(
 
		'lastmodified',
		'etag',
		'content-type',
		'content-length',
 
	);
 	// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%		
	// Interface
	// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%				
	public function initFromRaw( &$raw )
	{
		return $this->init( $raw, self::$fieldsHead, self::$fieldsBody );
	}
	
 } // end class declaration
 
  /* SAMPLE RESPONSE (from s3-dg-20060301.pdf)
    -----------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult xmlns="http://doc.s3.amazonaws.com/2006-03-01">
	<Name>quotes</Name>
	<Prefix>N</Prefix>
	<Marker>Ned</Marker>
	<MaxKeys>40</MaxKeys>
	<IsTruncated>false</IsTruncated>
	<Contents>
		<Key>Nelson</Key>
		<LastModified>2006-01-01T12:00:00.000Z</LastModified>
		<ETag>&quot;828ef3fdfa96f00ad9f27c383fc9ac7f&quot;</ETag>
		<Size>5</Size>
		<StorageClass>STANDARD</StorageClass>
		<Owner>
			<ID>bcaf1ffd86f41caff1a493dc2ad8c2c281e37522a640e161ca5fb16fd081034f</ID>
			<DisplayName>webfile</DisplayName>
		</Owner>
	</Contents>
	<Contents>
		<Key>Neo</Key>
		<LastModified>2006-01-01T12:00:00.000Z</LastModified>
		<ETag>&quot;828ef3fdfa96f00ad9f27c383fc9ac7f&quot;</ETag>
		<Size>4</Size>
		<StorageClass>STANDARD</StorageClass>
		<Owner>
			<ID>bcaf1ffd86f41caff1a493dc2ad8c2c281e37522a640e161ca5fb16fd081034f</ID>
			<DisplayName>webfile</DisplayName>
		</Owner>
	</Contents>
</ListBucketResult>
 */
 
 /*
	// HEAD operation


	HTTP/1.1 200 OK
	x-amz-id-2: KZ7XUBI18rqFH91yZmYpWSRPg0/aeqwJXVzNgnk9Pa9GcHUuN2cxfsKk7V3NSUKg
	x-amz-request-id: F7B5DF3AB381F03F
	Date: Wed, 01 Mar 2006 12:00:00 GMT
	x-amz-meta-family: Muntz
	Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT
	ETag: "828ef3fdfa96f00ad9f27c383fc9ac7f"
	Content-Type: text/plain
	Content-Length: 5
	Connection: close
	Server: AmazonS3

 */
